﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PhotoHash.aspx.cs" Inherits="PhotoHash" EnableViewState="false" EnableEventValidation="false" %>

<%@ Register tagname="Photos" tagprefix="uc" src="~/usercontrols/UCPhotos.ascx" %>
<%@ Register tagname="UCPaging" tagprefix="uc" src="~/usercontrols/UCPaging.ascx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link type="text/css" href="../../css/tables.css" rel=Stylesheet />
    <link type="text/css" href="../../css/paging.css" rel=Stylesheet />
    <link type="text/css" href="../../css/home.css" rel=Stylesheet />
    <style>
        table.detail th,td { vertical-align: top;
        }

        div.sel {
            border:2px solid red;
            opacity:.5
        }
        div.img {
            border:2px solid white;
        }
        td.td_img img {
            padding-right: 2px;
        }
        td.td_img {
            white-space:nowrap;
            max-width: 900px;
            overflow: auto;
        }
        label {
            padding:5px;
            border: solid 1px #eee;
        }
        div.box label {
            padding:0px;
            border: solid 0px #eee;
            
        }
        input[type="radio"]:checked+label {
            background-color:#eee;
        }
        
    </style>
    <script>
        function AddOrRemove(md5, id) {
            PageMethods.Toggle(md5, OnSuccess);

            var lnk1 = document.getElementById('ctrlLhs_' + id);
            var lnk2 = document.getElementById('ctrlRhs_' + id);
            var div = lnk1;
            if (null == lnk1)
                div = lnk2;
            if (div.className == 'sel')
                div.className = 'img'
            else
                div.className = 'sel';
        }
        function OnSuccess(response) {
            var ss = response;
            document.getElementById('lblSelected').innerText = ss[0];
            document.getElementById('colSelImg').innerHTML = ss[1];

        }
    </script>
</head>
<body>

    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server" EnablePageMethods="true" />
                
        <div style="margin-left:10px; margin-bottom:25px">
        <asp:Menu ID="menu" runat="server" 
            OnMenuItemClick="menu_MenuItemClick" Orientation="Horizontal" 
            ClientIDMode="AutoID">
            <StaticMenuItemStyle CssClass="menu_normal"   />
            <DynamicMenuItemStyle CssClass="menu_normal" />
            <StaticSelectedStyle CssClass="menu_selected" />
            <DynamicSelectedStyle CssClass="menu_selected" />
            <Items>
                <asp:MenuItem Value="0" Text="Home" />
                <asp:MenuItem Value="1" Text="Books"  />
                <asp:MenuItem Value="2" Text="Security" />
                <asp:MenuItem Value="3" Text="Changes" />
                <asp:MenuItem Value="4" Text="Data" />
                <asp:MenuItem Value="5" Text="Checks" />
                <asp:MenuItem Value="6" Text="Members" />
                <asp:MenuItem Value="7" Text="Types" />
                <asp:MenuItem Value="8" Text="Tags" />
                <asp:MenuItem Value="9" Text="Photos" />
                <asp:MenuItem Value="10" Text="Repeats" />
            </Items>
        </asp:Menu>
        </div> 

        <asp:PlaceHolder ID="plhDetail" runat="server" Visible="false">
            <table class="detail" cellpadding="5" cellspacing="0" border="1" style="border-collapse:collapse">
                <tr>
                    <th>MD5</th>
                    <td><asp:HyperLink ID="lblMD5" runat="server" /></td>
                </tr>
                <tr>
                    <th>Size</th>
                    <td>
                        <asp:Label ID="lblWidth" runat="server" />
                        x
                        <asp:Label ID="lblHeight" runat="server" />,
                        <asp:Label ID="lblSize" runat="server" />
                    </td>
                </tr>
                <tr>
                    <th>Created</th>
                    <td><asp:Label ID="lblCreated" runat="server" /></td>
                </tr>
                <tr id="rowParent" runat="server" visible="false">
                    <th>Parent</th>
                    <td><asp:HyperLink ID="lnkParent" runat="server" /> </td>
                </tr>
                <tr id="rowChild" runat="server" visible="false">
                    <th>Children</th>
                    <td><asp:PlaceHolder ID="plhChildren" runat="server" /></td>
                </tr>
            </table>
            <br /><br />
            <table class="detail" cellpadding="5" cellspacing="0" border="1" style="border-collapse:collapse">
                <tr>
                    <th>Before:</th>
                    <td style="background-color:#eee"><uc:Photos ID="ctrlBefore" runat="server" Columns="10" ShowLinks="true" Width="120" /> </td>
                </tr>
                <tr>
                    <th>Image
                        <asp:Label ID="lblIndex" runat="server" /> 
                    </th>
                    <td align="left">
                        <table>
                            <tr>
                                <td valign="top">
                        <asp:HyperLink ID="lnkImg" runat="server" Target="_blank"><asp:Image ID="img" runat="server"  /></asp:HyperLink> 
                                </td>
                                <td valign="top" style="padding:10px">
                                      <asp:Label id="lblCbl" runat="server" Text="Tags" Font-Bold="true" />
                                      <asp:CheckBoxList ID="cbl" runat="server" BackColor="#f5f5f5" DataTextField="NameAndCount" DataValueField="TagId" AutoPostBack="true" CellPadding="1" CellSpacing="0" OnSelectedIndexChanged="cbl_SelectedIndexChanged" />
                                      <asp:TextBox ID="txtTag" runat="server" Width="150px" Visible="true" />
                                      <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" Visible="true" />
                                </td>
                                <td style="padding-left:20px;padding-top:10px">
                                    <asp:PlaceHolder ID="plhO2O" runat="server" />
                                    <br />
                                    <div><b>Pages:</b></div>
                                    <ul ID="plhPages" runat="server" />
                                    <asp:DropDownList ID="ddPage" runat="server" DataTextField="FullName" DataValueField="ChapterId" OnSelectedIndexChanged="ddPage_SelectedIndexChanged" AutoPostBack="true" />
                                </td>
                            </tr>
                        </table>

                    </td>
                </tr>
                <tr>
                    <th>After:</th>
                    <td style="background-color:#eee"><uc:Photos ID="ctrlAfter" runat="server" Columns="10" ShowLinks="true"  Width="120" /> </td>
                </tr>
            </table>

        </asp:PlaceHolder>


    <asp:PlaceHolder ID="plhSearch" runat="server">
        <table cellpadding="10" style="margin-top:-20px;">
            <tr>
                <td valign="top" id="colTop" runat="server">
                    <asp:RadioButtonList ID="rbl" runat="server" AutoPostBack="true" RepeatLayout="Flow" RepeatDirection="Horizontal" CellSpacing="0" Font-Size="Larger" OnSelectedIndexChanged="rbl_SelectedIndexChanged" >
                        <asp:ListItem Value="0">All</asp:ListItem>
                        <asp:ListItem Value="1">Selection</asp:ListItem>
                        <asp:ListItem Value="2">Post</asp:ListItem>
                        <asp:ListItem Value="3">Tag</asp:ListItem>

                        <asp:ListItem Value="4">XRated</asp:ListItem>
                        <asp:ListItem Value="5">Delete</asp:ListItem>
                        <asp:ListItem Value="6">Laptop</asp:ListItem>
                    </asp:RadioButtonList>
                    <div class="box" id="pnlChapter" runat="server" style="width:700px;margin-left:0px ">
                        <label>Post: </label>
                        <asp:DropDownList ID="ddChapter" runat="server" DataTextField="FullName" DataValueField="ChapterId" AutoPostBack="true" OnSelectedIndexChanged="ddChapter_SelectedIndexChanged" Visible="false" />
                    </div>   

                    <div class="box" id="pnlTag" runat="server" style="margin-left:0px; white-space:nowrap; width:500px">
                        <label>Tag: </label>

                        <asp:DropDownList ID="ddTag" runat="server" DataTextField="NameAndCount" DataValueField="TagId" AutoPostBack="true" 
                            OnSelectedIndexChanged="ddTag_SelectedIndexChanged" Visible="false" style="margin-right:50px" />
                            &nbsp;
                        <asp:TextBox ID="txtName" runat="server" Width="100" Visible="false" />
                        <asp:Button ID="btnAddTag" runat="server" Text="Add" OnClick="btnAddTag_Click" Visible="false" />
                    </div>

                    <div class="box"  style="margin-left:0px; white-space:nowrap; width:600px; padding:10px;">

                        <asp:CheckBox ID="chkNoTag" runat="server" text="No-Tag" AutoPostBack="true" OnCheckedChanged="chkFilter_CheckedChanged" Font-Size="Smaller" />
                        <asp:CheckBox ID="chkNoPost" runat="server" text="No-Post" AutoPostBack="true" OnCheckedChanged="chkFilter_CheckedChanged" Font-Size="Smaller" />
                        <asp:CheckBox ID="chkCaption" runat="server" text="Caption" AutoPostBack="true" OnCheckedChanged="chkFilter_CheckedChanged" Font-Size="Smaller" />
                        <asp:CheckBox ID="chkXRated" runat="server" text="Xr" AutoPostBack="true" OnCheckedChanged="chkFilter_CheckedChanged" Font-Size="Smaller" />
                        <asp:CheckBox ID="chkDeleted" runat="server" text="Del" AutoPostBack="true" OnCheckedChanged="chkFilter_CheckedChanged" Font-Size="Smaller" />
                        <br />
                        <asp:DropDownList ID="ddHasTag" runat="server" DataTextField="NameAndCount" DataValueField="TagId" AutoPostBack="true" OnSelectedIndexChanged="ddHasTag_SelectedIndexChanged" Font-Size="10px" />
                        <asp:DropDownList ID="ddNotTag" runat="server" DataTextField="NameAndCount" DataValueField="TagId" AutoPostBack="true" OnSelectedIndexChanged="ddNotTag_SelectedIndexChanged" Font-Size="10px"  />
                        <asp:DropDownList ID="ddSortBy" runat="server"                                                     AutoPostBack="true" OnSelectedIndexChanged="ddSortBy_SelectedIndexChanged" Font-Size="10px"  />
                    </div>

                    <asp:Panel ID="pnlSelected" runat="server" CssClass="box" style="margin-top:10px; margin-left:0px">
                        <table>
                            <tr>
                                <td nowrap="nowrap">
                                    <asp:Label ID="lblSelected" runat="server" Font-Size="12px" /> 
                                </td>
                                <td id="colSelImg" rowspan="4" class="td_img">
                                    <asp:Literal ID="litSelImgs" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    <asp:Button ID="btnAddSelected" runat="server" Text="Add Selected" Enabled="false" OnClick="btnAddSelected_Click" />
                                    <asp:Button ID="btnXrated" runat="server" Text="X-R"  OnClick="btnXrated_Click" Font-Size="Smaller" />
                                    <asp:Button ID="btnDelete" runat="server" Text="Del"  OnClick="btnDelete_Click" Font-Size="Smaller" />
                                    <asp:Button ID="btnClearBucket" runat="server" Text="Clear"  OnClick="btnClearBucket_Click" />

                                    <asp:Button ID="btnClearCache" runat="server" Text="CC"  OnClick="btnClearCache_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    <asp:DropDownList ID="ddTagForSelected" runat="server"  DataTextField="NameAndCount" DataValueField="TagId" AutoPostBack="true" OnSelectedIndexChanged="ddTagForSelected_SelectedIndexChanged" />
                                    <asp:CheckBox ID="chkRemoveTag" runat="server" Text="Remove Tag: " Visible="false" />
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    <asp:TextBox ID="txtName2" runat="server" Width="100"/>
                                    <asp:Button ID="btnAddTag2" runat="server" Text="Add Tag" OnClick="btnAddTag_Click" />
                                     <asp:Button ID="btnRemoveLaptopTag" runat="server" Text="Rem. Tagged"  OnClick="btnRemoveLaptopTag_Click" Font-Size="Smaller" />
                                     <asp:Button ID="btnRemoveLaptopTagAll" runat="server" Text="Rem. All"  OnClick="btnRemoveLaptopTagAll_Click" Font-Size="Smaller" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td valign="top" id="colLHS" runat="server">
                    <asp:Label ID="lblLhs" runat="server" Text="Click to REMOVE" Font-Bold="true" />
                    <div style="height:50px">
                        <uc:Paging ID="ctrlPaging1" runat="server" PageSize="200" />
                    </div>
                    <uc:Photos ID="ctrlLhs" runat="server" Cols="10" />
                    <uc:Paging ID="ctrlPaging2" runat="server" PageSize="200" />
                </td>
                <td id="colBottom" runat="server" visible="false">
                    <asp:Label ID="Label1" runat="server" Text="Click to ADD" Font-Bold="true" />
                    <div style="height:50px">
                        <uc:Paging ID="ctrlPagingRhs1" runat="server" PageSize="200" QueryString="q" QueryString_PageSize="ps" QueryString_SortBy="sortq" QueryString_Descending="desq" /> &nbsp;
                    </div>
                    <uc:Photos ID="ctrlRhs" runat="server" Cols="5" />
                    <uc:Paging ID="ctrlPagingRhs2" runat="server" PageSize="200" QueryString="q" QueryString_PageSize="ps" QueryString_SortBy="sortq" QueryString_Descending="desq" />
                </td>
            </tr>

        </table>


    </asp:PlaceHolder>
    </form>
</body>
</html>